﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MatrixJudge_04
{
    class Program
    {
        static Boolean Judge(int[,] input)
        {
            Boolean result = true;
            int M = input.GetLength(0);
            int N = input.GetLength(1);
            int flag = input[0,0];
            for(int i = 0; i < M - 1; i++)
            {
                for (int j = 0; j < N - 1; j++)
                {
                    if (input[i, j] != input[i + 1, j + 1])
                        result = false;
                }
            }
            return result;
        }

        static void Main(string[] args)
        {
            Console.WriteLine("输入数组的行列数");
            String[] str = Console.ReadLine().Split(' ');
            int M = int.Parse(str[0]);
            int N = int.Parse(str[1]);
            int[,] input = new int[M,N];
            for(int i = 0; i < M; i++)
            {
               String[] str1= Console.ReadLine().Split(' ');
                for(int j = 0; j < N; j++)
                {
                    input[i,j] = int.Parse(str1[j]);
                }
            }
            if (Program.Judge(input))
                Console.WriteLine("是托普利兹矩阵");
            else
                Console.WriteLine("不是托普利兹矩阵");
          
            
            
        }
    }
}
